1. Field of the Invention
The present invention relates to a technology for mounting/unmounting a removable external storage device in a data processing apparatus.
2. Description of the Related Art
Recently, usage of external storage devices such as a universal serial bus (USB) flash memory and a secure digital (SD) memory card (registered trademark) is becoming increasingly common. Data stored in the external storage device can be transferred between various devices. For example, with the external storage device, image data that is shot by a digital camera can be viewed and processed on a personal computer (PC). A necessity to use such a removable external storage device is also increasing in a multifunction peripheral (MFP), which is an image forming apparatus having a plurality of functions including a scanner, a printer, etc. For example, in the MFP, scanned image data can be saved in the external storage device and the image data saved in the external storage device can be printed.
When using the external storage device in a system using an operating system (OS) such as the Unix (registered trademark), an explicit or implicit mounting/unmounting operation is required. The “mounting” means an operation to allocate a necessary resource that enables to access the internal portion of the external storage device on the system. Various technologies related to the mounting of the external storage device have been proposed. For example, in a technology disclosed in Japanese Patent Application Laid-open No. 2005-174241, upon notifying a specific application that an external storage device is inserted, the application activates a mounting process. In another technology disclosed in Japanese Patent Application Laid-open No. 2004-46801, upon insertion of an external storage device, the external storage device is automatically mounted.
On the contrary, the “unmounting” means an operation to release the resource allocated during the mounting and to ensure that data inside the external storage device is consistent. The unmounting of the external storage device is necessary because data from the external storage device is cached in the system (for example, on a main memory, etc.) for a high speed access to the external storage device on the OS. Recently, a technology called “journaling file system” is used to minimize data corruption due to a sudden power failure. In the journaling file system, a write-back of a journal (data) and the like are performed. Thus, a failure to perform the unmounting of the external storage device may result in that data that should be written back to the external storage device on the system is not actually written to the external storage device. A removal of the external storage device while data is being written to the external storage device may result in a serious problem such as lack of data integrity inside the external storage device.
In a method used by a PC system based on, for example, the Windows (registered trademark), upon detecting a connection of the external storage device, the system automatically mounts the device. At the time of unmounting the device, the system prompts a user to unmount the external storage device via a graphical user interface (GUI).
However, in a non-PC system such as the MFP, it is not desirable to explicitly issue an instruction to unmount the external storage device to a user. In some cases, the user may accidentally switch off the power source. If the power source is accidentally switched off while the external storage device is connected to the MFP, the data cached in the system is not actually written back to the external storage device and the data in the external storage device may get corrupted. In the MFP, various applications such as the scanner and the printer are operating independently. Thus, it is desired that the applications use the external storage device without interfering with each other.